package behavior.template_method;

/**
 * @author lzp
 * @Date:2023/3/8
 * @description: 读取配置的类
 */
public abstract class AbstractSetting {

	public final String getSetting(String key) {
		String value = lookupCache(key);
		if (value == null) {
			value = "调用查询方法";
			putIntoCache(key, value);
		}
		return value;
	}

	/**
	 * 从缓存中读取数据
	 *
	 * @param key 缓存的key
	 * @return
	 */
	protected abstract String lookupCache(String key);

	/**
	 * 数据存入华奴才能
	 *
	 * @param key
	 * @return
	 */
	protected abstract void putIntoCache(String key, String value);

}
